function coloring() {
    let r = Math.floor(Math.random() * 255)
    let g = Math.floor(Math.random() * 255)
    let b = Math.floor(Math.random() * 255)
    document.body.style.background = `rgb(${r},${g},${b})`;

}

function throttle(func, delay) {
    let pre = 0;
    return function () {
        let now = new Date();
        let context =this;
        let args=arguments;
        if (now - pre > delay) {
            func.apply(context,args);
            pre = now;
        }

    }
}

window.addEventListener('resize', throttle(coloring, 2000));